package com.cykj.pos.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cykj.common.annotation.DataSource;
import com.cykj.common.enums.DataSourceType;
import com.cykj.pos.domain.BizPosMachineStatusRecords;
import com.cykj.pos.domain.WxLication;
import com.cykj.pos.mapper.WxLicationMapper;
import com.cykj.pos.service.IWxLicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.xml.crypto.Data;
import java.util.Date;

@Service
public class WxLicationServiceImpl extends ServiceImpl<WxLicationMapper, WxLication> implements IWxLicationService {

    @Resource
    WxLicationMapper wxLicationMapper;

    @Override
    @DataSource(DataSourceType.SLAVE)
    public WxLication queryWxLicationInfo(int id) {
        LambdaQueryWrapper<WxLication> mapper = Wrappers.lambdaQuery();
        mapper.eq(WxLication::getId,id);
        WxLication wxLication = this.getOne(mapper);
        return wxLication;
    }

    @Override
    public void saveWxLicationInfo(WxLication wxLication1) {
        LambdaUpdateWrapper<WxLication> mapper = Wrappers.lambdaUpdate();
        mapper.eq(WxLication::getId,wxLication1.getId());
        wxLicationMapper.update(wxLication1,mapper);
    }

    @Override
    @DataSource(DataSourceType.SLAVE)
    public WxLication queryWxAppTime(WxLication wxLication) {
        LambdaQueryWrapper<WxLication> mapper = Wrappers.lambdaQuery();
        mapper.eq(WxLication::getId,wxLication.getId());
        WxLication wxLication1 = this.getOne(mapper);
        return wxLication1;
    }
}
